package com.maserb.monitor.web.analysis;

import com.maserb.monitor.common.AjaxResult;
import com.maserb.monitor.common.AjaxUtils;
import com.maserb.monitor.common.Func_T;
import com.maserb.monitor.dataCenter.handler.HistoryEigenValueRepositoryHandler;
import com.maserb.monitor.dataCenter.model.*;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

@Controller
@RequestMapping("/history")
public class HistoryController {
    @Autowired
    HistoryEigenValueRepositoryHandler eigenValueRepositoryHandler;

    @RequestMapping("/")
    public String index() {
        return "analysis/history/index";
    }

    @RequestMapping("/getEigenValue")
    @ResponseBody
    public AjaxResult<HistoryEigenResponseResult> getEigenValue(final HistoryEigenRequest request) {
        return AjaxUtils.process(new Func_T<HistoryEigenResponseResult>() {
            @Override
            public HistoryEigenResponseResult invoke() throws Exception {
                HistoryEigenResponseResult result = eigenValueRepositoryHandler.getHistoryData(request);
                return result;
            }
        });
    }
}
